package com.luhuiguo.cms.server.web;

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.bradmcevoy.http.HttpManager;
import com.bradmcevoy.http.ServletRequest;
import com.bradmcevoy.http.ServletResponse;

@Controller
public class DavController {

    private static final Logger logger = LoggerFactory.getLogger(DavController.class);

    @Inject
    private HttpManager httpManager;

    @RequestMapping({ "*", "/**" })
    public ModelAndView handleDav(HttpServletRequest request, HttpServletResponse response) throws Exception {
        logger.debug("handleDav: " + request.getRequestURI() + " method:" + request.getMethod());
        
        ServletRequest rq = new ServletRequest(request);
        ServletResponse rs = new ServletResponse(response);
        httpManager.process(rq, rs);
        return null;
    }

}
